<?php
ini_set( 'include_path', '../;.' );

//
// In order to view the output you will need to download neato from http://www.graphviz.org/
//

require_once( 'include_package.php' );

include_package( 'Datasources' );
include_package( 'DatabaseModel' );
include_package( 'Renderers', true );

Session::Start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>P-dd: A simple example outputting a configured DOT generated diagram using the TestDatasource</title>
</head>
<body>
<?php

$oConfiguration = new DotRendererConfiguration();
$oConfiguration->SetProperty( 'ShowColumnProperties', true );
$oConfiguration->SetProperty( 'TableFontFamily'     , 'courier' );
$oConfiguration->SetProperty( 'TableFontSize'       , 10 );
$oConfiguration->SetProperty( 'CurvedKeys'          , false );

$oFactory = new DatabaseFactory(  new TestDatasource() );
$oDatabase = $oFactory->ConstructDatabase();

$oImageGenerator = new DotImageGenerator( DotDatabaseRenderer::Render( $oConfiguration, $oDatabase ) );
$sImage = $oImageGenerator->GenerateImageInSession( 'Gif', 'ExampleImage' );
echo( HtmlTag::Image( '../SessionImageLoader.php?ImageId='.$sImage, 'Dot generated diagram (using NEATO)') );

?>
</body>
</html>